<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>科学饮食 - 首页</title>
    <style>
        /* 基础样式 */
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            font-family: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
        }

        body {
            background-color: #f8f9fa;
            color: #333;
            padding-bottom: 70px; /* 为底部导航留空间 */
        }

        .container {
            padding: 15px;
            max-width: 600px;
            margin: 0 auto;
        }

        /* 顶部标题 */
        .header {
            padding: 15px 0;
            text-align: center;
        }

        .header h1 {
            font-size: 24px;
            color: #2e7d32;
            font-weight: 600;
        }

        /* 搜索框 */
        .search-container {
            margin: 15px 0;
            position: relative;
        }

        .search-box {
            width: 100%;
            padding: 12px 20px;
            padding-left: 45px;
            border: none;
            border-radius: 25px;
            background-color: white;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
            font-size: 16px;
        }

        .search-icon {
            position: absolute;
            left: 15px;
            top: 50%;
            transform: translateY(-50%);
            color: #757575;
        }

        /* 营养卡片滑动区 */
        .nutrition-section {
            margin: 20px 0;
        }

        .section-title {
            font-size: 18px;
            font-weight: 600;
            margin-bottom: 15px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .card-scroll {
            display: flex;
            overflow-x: auto;
            gap: 15px;
            padding-bottom: 10px;
            scrollbar-width: none; /* Firefox */
        }

        .card-scroll::-webkit-scrollbar {
            display: none; /* Chrome/Safari */
        }

        .nutrition-card {
            min-width: 180px;
            padding: 15px;
            background: white;
            border-radius: 12px;
            box-shadow: 0 4px 8px rgba(0,0,0,0.05);
        }

        .card-title {
            font-size: 14px;
            color: #757575;
            margin-bottom: 8px;
        }

        .card-value {
            font-size: 20px;
            font-weight: 600;
            margin-bottom: 10px;
        }

        .progress-bar {
            height: 6px;
            background: #e0e0e0;
            border-radius: 3px;
            overflow: hidden;
        }

        .progress {
            height: 100%;
            background: #4caf50;
            border-radius: 3px;
            width: 65%;
        }

        /* 食物分类 */
        .category-section {
            margin: 25px 0;
        }

        .category-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 15px;
        }

        .category-item {
            background: white;
            border-radius: 10px;
            padding: 15px 10px;
            text-align: center;
            box-shadow: 0 2px 5px rgba(0,0,0,0.05);
            transition: transform 0.2s;
        }

        .category-item:active {
            transform: scale(0.95);
        }

        .category-icon {
            width: 40px;
            height: 40px;
            margin: 0 auto 8px;
            background-color: #e8f5e9;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #2e7d32;
        }

        .category-name {
            font-size: 12px;
            color: #424242;
        }

        /* 底部导航 */
        .nav-bar {
            position: fixed;
            bottom: 0;
            width: 100%;
            background: white;
            display: flex;
            justify-content: space-around;
            padding: 12px 0;
            box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
            max-width: 600px;
            margin: 0 auto;
            left: 50%;
            transform: translateX(-50%);
        }

        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: #757575;
            text-decoration: none;
            font-size: 12px;
        }

        .nav-item.active {
            color: #2e7d32;
        }

        .nav-icon {
            font-size: 20px;
            margin-bottom: 4px;
        }
    </style>
</head>
<body>
<div class="container">
    <!-- 顶部标题 -->
    <div class="header">
        <h1>科学饮食</h1>
    </div>

    <!-- 搜索框 -->
    <div class="search-container">
        <span class="search-icon">🔍</span>
        <input type="text" class="search-box" placeholder="搜索食物、菜谱...">
    </div>

    <!-- 营养摄入卡片 -->
    <div class="nutrition-section">
        <h2 class="section-title">今日营养摄入</h2>
        <div class="card-scroll">
            <div class="nutrition-card">
                <div class="card-title">热量</div>
                <div class="card-value">1200/2000 kcal</div>
                <div class="progress-bar">
                    <div class="progress" style="width: 60%"></div>
                </div>
            </div>

            <div class="nutrition-card">
                <div class="card-title">蛋白质</div>
                <div class="card-value">45/65 g</div>
                <div class="progress-bar">
                    <div class="progress" style="width: 70%"></div>
                </div>
            </div>

            <div class="nutrition-card">
                <div class="card-title">脂肪</div>
                <div class="card-value">30/50 g</div>
                <div class="progress-bar">
                    <div class="progress" style="width: 60%"></div>
                </div>
            </div>

            <div class="nutrition-card">
                <div class="card-title">碳水化合物</div>
                <div class="card-value">150/300 g</div>
                <div class="progress-bar">
                    <div class="progress" style="width: 50%"></div>
                </div>
            </div>
        </div>
    </div>

    <!-- 食物分类 -->
    <div class="category-section">
        <h2 class="section-title">食物分类</h2>
        <div class="category-grid">
            <div class="category-item">
                <div class="category-icon">🍎</div>
                <div class="category-name">水果</div>
            </div>

            <div class="category-item">
                <div class="category-icon">🥦</div>
                <div class="category-name">蔬菜</div>
            </div>

            <div class="category-item">
                <div class="category-icon">🍞</div>
                <div class="category-name">谷物</div>
            </div>

            <div class="category-item">
                <div class="category-icon">🥩</div>
                <div class="category-name">肉类</div>
            </div>

            <div class="category-item">
                <div class="category-icon">🥛</div>
                <div class="category-name">乳制品</div>
            </div>

            <div class="category-item">
                <div class="category-icon">🥜</div>
                <div class="category-name">坚果</div>
            </div>

            <div class="category-item">
                <div class="category-icon">🍣</div>
                <div class="category-name">海鲜</div>
            </div>

            <div class="category-item">
                <div class="category-icon">🍰</div>
                <div class="category-name">甜点</div>
            </div>
        </div>
    </div>
</div>

<!-- 底部导航 -->
<div class="nav-bar">
    <a href="#" class="nav-item active">
        <span class="nav-icon">🏠</span>
        <span>首页</span>
    </a>
    <a href="#" class="nav-item">
        <span class="nav-icon">📊</span>
        <span>记录</span>
    </a>
    <a href="#" class="nav-item">
        <span class="nav-icon">👤</span>
        <span>我的</span>
    </a>
</div>
</body>
</html>